package sxe.core.math;

import snobject.snDouble;
import snobject.snObject;
import snobject.snObjectArgList;
import step.FunctionWrapper;
import step.EvaluationFailure;

/**
 * Converts an angle measured in radians to an approximately equivalent angle measured in degrees.
 * The conversion from radians to degrees is generally inexact;
 * users should not expect cos(toRadians(90.0)) to exactly equal 0.0.
 * @param argv must contain an snDouble object at top of the stack representing an angle in radians
 * @return returns the measurement of the angle in degrees
 */

public class toDegrees extends FunctionWrapper{
	
	public snObject Call(snObjectArgList argv) throws EvaluationFailure{
		// REQUIRES: argv must contain an snDouble object at top of the stack representing an angle in radians
		// EFFECTS: returns the snDouble of the measurement of the angle in degrees of the value from argv
		double ret = argv.popDouble().getDbl();
		
		return new snDouble(Math.toDegrees(ret));
	}
}